this._client?.disconnectObject(this);
this._client = client;
+ this._client?.connectObject(
+ 'notify::networking-enabled', () => this._sync(),
+ this);
this._items.forEach(item => item.destroy());
this._items.clear();
}
_sync() {
- this.visible = this._items.size > 0;
+ this.visible =
+ this._client?.networking_enabled && this._items.size > 0;
this._updateItemsVisibility();
this._updateChecked();
this._itemBinding.source = this._getPrimaryItem();
this._client.bind_property('nm-running',
this, 'visible',
GObject.BindingFlags.SYNC_CREATE);
- this._client.bind_property('networking-enabled',
- this.menu.actor, 'visible',
- GObject.BindingFlags.SYNC_CREATE);
this._client.connectObject(
'notify::primary-connection', () => this._syncMainConnection(),